import 'package:FlutterStudy/PageViewDemo.dart';
import 'package:FlutterStudy/demo/CardDemo.dart';
import 'package:FlutterStudy/demo/DataTableDemo.dart';
import 'package:FlutterStudy/demo/StepDemo.dart';
import 'package:flutter/material.dart';

import '../demo/PaginDataTableDemo.dart';

class MDCDemo extends StatefulWidget {
  @override
  _MDCDemoState createState() {
    return _MDCDemoState();
  }
}

class _MDCDemoState extends State<MDCDemo> {
  var _selectName = "";
  var _actionTag = ["apple", "banana", "Lemon"];

  @override
  void initState() {
    super.initState();
  }

  @override
  void dispose() {
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    // TODO: implement build

    return
    SingleChildScrollView(
      child:   Wrap(
        crossAxisAlignment: WrapCrossAlignment.end,
        runAlignment: WrapAlignment.start,
        clipBehavior: Clip.hardEdge,
        spacing: 10,
        runSpacing: 5,
        children: [
          SizedBox(width: 0),
          Chip(
            shape: RoundedRectangleBorder(
              borderRadius: BorderRadius.all(Radius.circular(10)),
            ),
            label: Text("chip"),
            backgroundColor: Colors.orange[100],
            avatar: CircleAvatar(
              backgroundColor: Colors.grey,
              backgroundImage: NetworkImage(
                "https://pic.rmb.bdstatic.com/bjh/0d7e5f97317ad00c58d2b80a0d4be02a1054.jpeg@h_1280",
              ),
            ),
          ),
          Chip(
            label: Text("chip"),
            backgroundColor: Colors.orange[100],
            avatar: CircleAvatar(
              backgroundColor: Colors.grey,
              backgroundImage: NetworkImage(
                "https://pic.rmb.bdstatic.com/bjh/0d7e5f97317ad00c58d2b80a0d4be02a1054.jpeg@h_1280",
              ),
            ),
          ),
          Chip(
            label: Text("chip"),
            backgroundColor: Colors.orange[100],
            avatar: CircleAvatar(
              backgroundColor: Colors.grey,
              child: Image.network(
                "https://pic.rmb.bdstatic.com/bjh/0d7e5f97317ad00c58d2b80a0d4be02a1054.jpeg@h_1280",
              ),
            ),
          ),
          Chip(
            shape: RoundedSuperellipseBorder(
              borderRadius: BorderRadius.only(topLeft: Radius.circular(10)),
            ),
            label: Text("chip"),
            backgroundColor: Colors.orange[100],
            avatar: CircleAvatar(
              backgroundColor: Colors.grey,
              child: Image.network(
                "https://pic.rmb.bdstatic.com/bjh/0d7e5f97317ad00c58d2b80a0d4be02a1054.jpeg@h_1280",
              ),
            ),
          ),
          Divider(thickness: 0.3, color: Colors.grey),
          Chip(
            shape: RoundedSuperellipseBorder(
              borderRadius: BorderRadius.only(topLeft: Radius.circular(10)),
            ),
            label: Text("chip"),
            backgroundColor: Colors.orange[100],
            avatar: CircleAvatar(
              backgroundColor: Colors.grey,
              child: Image.network(
                "https://pic.rmb.bdstatic.com/bjh/0d7e5f97317ad00c58d2b80a0d4be02a1054.jpeg@h_1280",
              ),
            ),
          ),
          Chip(

            onDeleted: () => debugPrint('delete'),
            // 这句话设置之后参显示
            deleteIcon: Icon(Icons.delete),
            deleteIconColor: Colors.orange,
            deleteButtonTooltipMessage: "delete from chip",
            shape: RoundedSuperellipseBorder(
              borderRadius: BorderRadius.only(topLeft: Radius.circular(10)),
            ),
            label: Text("chip"),
            backgroundColor: Colors.orange[100],
            avatar: CircleAvatar(
              backgroundColor: Colors.grey,
              child: Image.network(
                "https://pic.rmb.bdstatic.com/bjh/0d7e5f97317ad00c58d2b80a0d4be02a1054.jpeg@h_1280",
              ),
            ),
          ),
          Divider(),
          Container(child: Text("action chip name ${_selectName}")),
          Wrap(
            children: _actionTag.map((tag) {
              return ActionChip(
                label: Text("action chip"),
                onPressed: () {
                  setState(() {
                    _selectName = tag;
                  });
                },
              );
            }).toList(),
          ),

          Container(child: Text("filter chip name ${_selectName}")),
          Wrap(
            children: _actionTag.map((tag) {
              return FilterChip(
                label: Text("action chip"),
                selected: _selectName==tag,
                onSelected: (isSeleted) {
                  setState(() {
                    if (isSeleted) {
                      _selectName = tag;
                    } else {
                      _selectName = "";
                    }
                  });
                },
              );
            }).toList(),
          ),
          Container(child: Text("choice chip name ${_selectName}")),
          Wrap(
            children: _actionTag.map((tag) {
              return ChoiceChip(

                showCheckmark: false,
                selectedColor: Colors.green,
                label: Text("action chip"),
                selected: _selectName==tag,
                onSelected: (isSeleted) {
                  setState(() {
                    if (isSeleted) {
                      _selectName = tag;
                    } else {
                      _selectName = "";
                    }
                  });
                },
              );
            }).toList(),
          ),
          DataTableDemo(),
          PaginDataTableDemo(),
          Divider(),
          Text("card"),
          CardDemo(),
          Divider(),
          Text("step"),
          StepDemo()

        ],
      ),
    );
  }
}
